package apiday02homework;

public class PointDemo {
    public static void main(String[] args) {
        Point p = new Point();
        p.setX(100);
        p.setY(200);
        System.out.println(p.getX());
        System.out.println(p.getY());
        System.out.println(p.toString());
        String  str ="123"+p;
        System.out.println(str);
        System.out.println("~~~~~~~~~~~~~~~~");

        String  s1 =new String("abc");
        String s2 = new String("abc");
        System.out.println(s1==s2);
        System.out.println(s1.equals(s2));

        StringBuilder stringBuilder1 = new StringBuilder("abc");
        StringBuilder stringBuilder2 = new StringBuilder("abc");
        System.out.println(stringBuilder1==stringBuilder2);
        // StringBuilder没有重写equals方法
        System.out.println(stringBuilder1.equals(stringBuilder2));
        //s1与builder1的类型不同，所以equals()一定是false
        System.out.println(s1.equals(stringBuilder1));

        System.out.println("~~~~~~~~~~~~~~~~");
        Point p1 = new Point(100, 200);
        Point p2 = new Point(100, 200);
        System.out.println(p1==p2);
        // Point重写了equals方法
        System.out.println(p1.equals(p2));
    }
}
